package com.tanhan.mindapp.controller;


import com.tanhan.mindapp.dao.Result;
import com.tanhan.mindapp.dao.SysUser;
import com.tanhan.mindapp.service.SysUserService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/login")
@Tag(name = "系统角色登录", description = "登录")
@Slf4j
public class SysLoginController {
    @Autowired
    private SysUserService sysUserService;

    @PostMapping("")
    public Result login(@RequestBody() SysUser sysUser) {
        String token = sysUserService.login(sysUser.getUserName(), sysUser.getPassword());
        log.info("后台用户登录");
        return Result.success(token);
    }
}
